package com.gjy.nio;

import com.google.common.collect.Lists;
import lombok.Data;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-03-14 16:22:01
 */
public class T333 {

    @Test
    public void test1() {
        List<T1> list = new ArrayList<>();
        T1 t1 = new T1();
        t1.setSs(Lists.newArrayList(1, 2, 3));
        T1 t2 = new T1();
        t2.setSs(Lists.newArrayList(4, 5, 6));

        list.add(t1);
        list.add(t2);

        List<Integer> collect = list.stream().flatMap(l -> l.getSs().stream())
                .collect(Collectors.toList());
        System.out.println(collect);
    }

    @Data
    private static final class T1 {

        List<Integer> ss;
    }
}
